package com.xiaoji.ssh.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import com.xiaoji.ssh.dao.UsersDao;
import com.xiaoji.ssh.entity.Users;

@Repository
public class UsersDaoimpl implements UsersDao{

	private HibernateTemplate hibernateTemplate;	
	
	public HibernateTemplate getHibernateTemplate() {
		return hibernateTemplate;
	}

	@Autowired
	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}

	public Users findByName(String username) {
		String hql= "from Users u where u.account=?";
		List<Users> list = this.getHibernateTemplate().find(hql, new String[]{username});  
		
		return list.get(0);
	}

}
